-- agore tem alteracoes ... testing svn only
--
-- more changes herer... lol
--
-- events.lua -> control events in all items and cal the correspondent procedure

-- initial value of the control variable
theScreen = "mainScreen";

function generalControler(e, id, arg)
-- if arg not have value, is a menu item
	if(arg ~= nil) then
		gui.alert(e..' - '..id..'-'..arg)
	else
		gui.alert(e..' - '..id)
	end

	-- main menu options, avaliable in all screens
	if(e==21 and id==1) then
		mmgui:mainScreen()
	elseif(e==21 and id ==2) then
		mmgui:newRegister()
	elseif(e==21 and id==3) then
		mmgui:showRegisterTypes()
	elseif(e==21 and id==4) then
		mmgui:showGraphics()
	elseif(e==21 and id==5) then
		mmgui:syncDevice()
	elseif(e==21 and id==6) then
		mmgui:aboutProgram()
	end


	-- tests by screen name (internal name)
	if(theScreen == "mainScreen") then
		if(e==14 and id==1802 and arg ==1) then
			--gui.selectdate("Select a date")
		elseif(e==14 and id==1802 and arg ==2) then
			--gui.selectdate("Select a date")
		elseif(e==14 and id==1802 and arg ==3) then
			--gui.selectdate("Select a date")
		elseif(e==14 and id==1802 and arg ==4) then
			--gui.selectdate("Select a date")
		elseif(e==14 and id==1802 and arg ==5) then
			gui.selectdate("Initial Date")
			gui.selectdate("Final Date")
		elseif(e==14 and id==1802 and arg ==6) then
			gui.selectdate("Select a Date")
		end
	
		if(e==9 and id==1804 and arg ==0) then
			mmgui:newRegister()
		end

	elseif(theScreen == "aboutProgram") then
		if(e==9 and id==1801 and arg ==0) then
			mmgui:mainScreen()
		end
	
	elseif(theScreen == "showRegisterTypes") then
		if(e==9 and id==1801 and arg ==0) then
			mmgui:newRegisterType()
		end
	
	elseif(theScreen == "newRegisterType") then

	elseif(theScreen == "newRegister") then
		if(e==9 and id ==1809 and arg ==0) then
			ano,mes,dia = gui.selectdate("Select a Date")
			-- 1808 -> the 1809 (button) before component on screen
			-- direct atributions (like this) is dangerous... but...
			gui.settext(1808,ano.."-"..mes.."-"..dia)
		end

	elseif(theScreen == "showGraphics") then

	elseif(theScreen == "syncDevice") then

	end
	

end


